import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false

Vue.directive('keyup-enter',{
	inserted(el, binding) {
		let $inputs = el.getElementsByTagName('input')
		Array.from($inputs).forEach( $item => {
			$item.addEventListener('keydown', event => {
				let e = event || window.event
		        if (e.keyCode === 13) {
		          if (binding.value) {
		            setTimeout(() => {
		              binding.value()
		            }, 100)
		          }
		        }
			})
		})
	}
})


new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})
